//加载express模块 
const express = require('express'); 

//创建web服务器 
const app = express(); 

app.use(express.urlencoded({extended:true}));
app.use(express.json());

//加载cors跨域中间件
const cors = require('cors')
//注册cors
app.use(cors())

// 允许访问静态资源
app.use(express.static(__dirname))

const userInfoRouter=require('./router/userRouter')
const addressRouter=require('./router/addressRouter')
const adminRouter = require('./router/adminRouter') 
const orderRouter = require('./router/orderRouter');
app.use(userInfoRouter)
app.use(addressRouter)
app.use(adminRouter)
app.use(orderRouter);
//监听5000端口，即web服务器运行在4000端口 
app.listen(5000,()=>{ console.log('server running at 5000') })